<template>
  <div class="pz_box cardCont" :class="styleOptions[sportConfig.content.style]">
    <div v-for="(item, index) in sportConfig.venueContent.customList" :key="index" class="pz_box_item mb3">
      <img class="pzImg" :src="item.icon || item.img2">
      <div class="pz_box_item_box">
        <div :class="{overflowLine: sportConfig.content.style != '3'}" class="name overflow2">{{ item.title || item.name }}</div>
        <div v-if="sportConfig.content.param.indexOf('1') > -1" class="time">{{ item.createDate || item.bean.createTime }}</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    config: {
      type: Object,
      default: () => ({})
    }
  },
  data() {
    return {
      sportConfig: {
        content: {},
        venueContent: {
          customList: []
        }
      },
      styleOptions: {
        '1': 'hd',
        '2': 'dt',
        '3': 'zt',
        '4': 'sx'
      }
    }
  },
  watch: {
    config(val) {
      this.sportConfig = this.config
      // console.log('watch', this.sportConfig)
    }
  }
}
</script>

<style lang="scss" scoped>
@import '@/styles/variables.scss';
	.pz_box {
		.pzImg {
			vertical-align: top;
		}
		.pz_box_item {
			width: 100%;
			background: #FFFFFF;
			border-radius: 8px;
			position: relative;
			overflow: hidden;
			.time {
				font-size: 24px;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #999999;
				margin-top: 10px;
			}

			.title {
				font-size: 30px;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #222222;
				line-height: 1;
			}
		}

		&.dt,
		&.sx {
			.pz_box_item {
				// border: 1px solid #E5E5E5;

				.pzImg {
					width: 100%;
					height: 388px;
				}

				.pz_box_item_box {
					position: static;
					box-sizing: border-box;
					padding: 20px;
				}
			}
		}

		&.sx {
			display: flex;
			flex-wrap: wrap;
			background-color: #fff;

			&:before {
				clear: both;
				content: '';
				display: block;
			}

			.pz_box_item {
				// border: 1px solid #E5E5E5;
				width: 49%;
				float: left;
				box-sizing: border-box;
				margin-right: 2%;

				&:nth-child(2n) {
					margin-right: 0;
				}

				.pzImg {
					height: 188px;
				}

				.pz_box_item_box {
					.title {
						overflow: hidden;
						height: 80px;
						margin-bottom: 20px;
						text-overflow: ellipsis;
						display: -webkit-box;
						line-height: 40px;
						-webkit-line-clamp: 2;
						/* autoprefixer: off */
						-webkit-box-orient: vertical;
						/* autoprefixer: on */
					}
				}

			}
		}

		&.hd {
			display: flex;
      width: 100%;
      overflow-x: auto;

			.pz_box_item {
        flex-shrink: 0;
				// border: 1px solid #E5E5E5;
				width: 440px;
				display: inline-block;
				margin-right: 30px;

				&:last-of-type {
					margin-right: 0;
				}

				.pzImg {
					width: 100%;
					height: 247px;
				}

				.pz_box_item_box {
					position: static;
					box-sizing: border-box;
					background-color: #fff;
					padding: 20px;

					.title {
						overflow: hidden;
						margin-bottom: 10px;
						text-overflow: ellipsis;
						display: -webkit-box;
						line-height: 40px;
						-webkit-line-clamp: 1;
						/* autoprefixer: off */
						-webkit-box-orient: vertical;
						/* autoprefixer: on */
					}
				}
			}
		}

		&.zt {
			.pz_box_item {
				display: flex;
				justify-content: space-between;
				background: none;
				.pzImg {
					width: 260px;
					border-radius: 8px;
					flex: none;
					height: 146px;
				}

				.pz_box_item_box {
					flex: 1;
					box-sizing: border-box;
					padding-left: 20px;
					display: flex;
					flex-direction: column;
					justify-content: space-between;
          .overflow2{
            overflow: hidden;
            text-overflow: ellipsis;
            display: -webkit-box;
            -webkit-line-clamp: 2;
            -webkit-box-orient: vertical;
          }
				}
			}
		}
	}
</style>
